package com.omg.api.entry;

import javax.servlet.http.HttpServletRequest;

import com.omg.api.argument.Argument;
import com.omg.api.argument.FriendArgument;
import com.omg.api.handle.FriendHandler;
import com.omg.constant.ResponseCode;

/**
 * Get Friends By Userid
 * 
 * @author roger
 * 
 */
public class friend extends Entry {

	private static final long serialVersionUID = 1L;

	@Override
	protected Argument fetchArgument(HttpServletRequest request)
			throws Exception {
		String userid = request.getParameter("userid");
		if (userid == null || userid.isEmpty()) {
			throw new Exception("" + ResponseCode.AP_E_Info_InvalidUserid);
		}

		FriendArgument argument = new FriendArgument();
		argument.setUserid(userid);

		return argument;
	}

	@Override
	protected String getResult(Argument argument) throws Exception {
		return FriendHandler.getInstance().handle(argument);
	}
}
